package nmt.banweb.client;

import nmt.banweb.shared.FieldVerifier;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.InlineHTML;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Banweb implements EntryPoint {

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		// Use RootPanel.get() to get the entire body element
		RootPanel rootPanel = RootPanel.get("nameFieldContainer");
		
		// set the size of the horizontal panel, and
		// attach it to something that is centered in the screen
		HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
		horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		rootPanel.add(horizontalPanel_1, 10, 10);
		horizontalPanel_1.setSize("616px", "508px");
		
		// create a vertical panel to hold the other vertical panel where I want it (centered, top, bottom)
		VerticalPanel verticalPanel_1 = new VerticalPanel();
		horizontalPanel_1.add(verticalPanel_1);
		verticalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		verticalPanel_1.setSize("780px", "780px");
		
		// create a second vertical panel to house the content
		VerticalPanel verticalPanel_2 = new VerticalPanel();
		verticalPanel_1.add(verticalPanel_2);
		
		// header
		HorizontalPanel header_pane = new HorizontalPanel();
		verticalPanel_2.add(header_pane);
		header_pane.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		header_pane.setSize("466px", "99px");
		
		InlineHTML nlnhtmlHeader = new InlineHTML("Header");
		header_pane.add(nlnhtmlHeader);
		
		// menu
		HorizontalPanel menu_pane = new HorizontalPanel();
		verticalPanel_2.add(menu_pane);
		menu_pane.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		
		HorizontalPanel menuPanel = new HorizontalPanel();
		menu_pane.add(menuPanel);
		
		Button btnViewSchedule = new Button("View Schedule");
		menuPanel.add(btnViewSchedule);
		
		Button btnCourseOffering = new Button("Course Offering");
		menuPanel.add(btnCourseOffering);
		
		Button btnAddByCrn = new Button("Add by CRN");
		menuPanel.add(btnAddByCrn);
		
		Button btnBlacklist = new Button("Blacklist");
		menuPanel.add(btnBlacklist);
		
		Button btnSearch = new Button("Search");
		menuPanel.add(btnSearch);
		
		Button btnSave = new Button("Save");
		menuPanel.add(btnSave);
		
		// body
		HorizontalPanel body_pane = new HorizontalPanel();
		verticalPanel_2.add(body_pane);
		
		// content of the page
		VerticalPanel verticalPanel = new VerticalPanel();
		body_pane.add(verticalPanel);
		verticalPanel.setSize("466px", "30px");
		menuPanel.getElement().getStyle().setPosition(Position.FIXED);
		
		// and lastly...
		// remove that nasty static-positioning bug that comes up in css
		RootPanel.get().getElement().getStyle().setPosition(Position.RELATIVE);
		horizontalPanel_1.getElement().getStyle().setPosition(Position.RELATIVE);
	}
}
